﻿using System;

using Akabana.Amf.Messaging;
using Akabana.Sample.Greeting;

namespace Akabana.Sample.Greeting.Web
{
    [MessagingService]
    public class GreetingService
    {

        private static Greeting NewGreeting(string word, DateTime startDateTime, DateTime endDateTime)
        {
            var result = new Greeting();
            result.word = word;
            result.startDateTime = startDateTime;
            result.endDateTime = endDateTime;

            return result;
        }

        public Greeting GetGreeting(Person person,DateTime? date)
        {
            if (person is Japanese)
            {
                return NewGreeting("こんにちは",person.startDateTime, person.endDateTime);
            }
            else if (person is English)
            {
                return NewGreeting("Hello", person.startDateTime, person.endDateTime);
            }
            else
            {
                return NewGreeting("ﾅﾏｽﾃ!!!", person.startDateTime, person.endDateTime);
            }
        }

        public void Goodbye()
        {

        }
    }
}
